package com.ruoyi.project.user.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.user.mapper.BinsViolationRecordMapper;
import com.ruoyi.project.user.domain.BinsViolationRecord;
import com.ruoyi.project.user.service.IBinsViolationRecordService;

/**
 * 违规记录Service业务层处理
 * 
 * @author administrator
 * @date 2025-04-03
 */
@Service
public class BinsViolationRecordServiceImpl implements IBinsViolationRecordService 
{
    @Autowired
    private BinsViolationRecordMapper binsViolationRecordMapper;

    /**
     * 查询违规记录
     * 
     * @param violationId 违规记录主键
     * @return 违规记录
     */
    @Override
    public BinsViolationRecord selectBinsViolationRecordByViolationId(Long violationId)
    {
        return binsViolationRecordMapper.selectBinsViolationRecordByViolationId(violationId);
    }

    /**
     * 查询违规记录列表
     * 
     * @param binsViolationRecord 违规记录
     * @return 违规记录
     */
    @Override
    public List<BinsViolationRecord> selectBinsViolationRecordList(BinsViolationRecord binsViolationRecord)
    {
        return binsViolationRecordMapper.selectBinsViolationRecordList(binsViolationRecord);
    }

    /**
     * 新增违规记录
     * 
     * @param binsViolationRecord 违规记录
     * @return 结果
     */
    @Override
    public int insertBinsViolationRecord(BinsViolationRecord binsViolationRecord)
    {
        if (StringUtils.isBlank(binsViolationRecord.getViolationType())){
            binsViolationRecord.setViolationType("0");
        }
        binsViolationRecord.setCreateTime(DateUtils.getNowDate());
        return binsViolationRecordMapper.insertBinsViolationRecord(binsViolationRecord);
    }

    /**
     * 修改违规记录
     * 
     * @param binsViolationRecord 违规记录
     * @return 结果
     */
    @Override
    public int updateBinsViolationRecord(BinsViolationRecord binsViolationRecord)
    {
        binsViolationRecord.setUpdateTime(DateUtils.getNowDate());
        return binsViolationRecordMapper.updateBinsViolationRecord(binsViolationRecord);
    }

    /**
     * 批量删除违规记录
     * 
     * @param violationIds 需要删除的违规记录主键
     * @return 结果
     */
    @Override
    public int deleteBinsViolationRecordByViolationIds(Long[] violationIds)
    {
        return binsViolationRecordMapper.deleteBinsViolationRecordByViolationIds(violationIds);
    }

    /**
     * 删除违规记录信息
     * 
     * @param violationId 违规记录主键
     * @return 结果
     */
    @Override
    public int deleteBinsViolationRecordByViolationId(Long violationId)
    {
        return binsViolationRecordMapper.deleteBinsViolationRecordByViolationId(violationId);
    }
}
